# -*- coding: utf-8 -*-

# File Name： __init__.py
# Description :
# Author : lirui
# create_date： 2022/6/3
# Change Activity:
from .mlp import MLP
from .res_layer import ResLayer
from .resnet_block import ResnetBlock
from ....common.design_pattern.register.register_factory import REGISTER_FACTORY
from .multi_attention.dab_encoder import DABEncoder
from .multi_attention.dab_encoder_layer import DABEncoderLayer

_registry_name = 'model_modules'


def _build_registry():
    """
    build normal lay registry.

    """
    _register = REGISTER_FACTORY.create_registry(_registry_name)
    _register.add('DABEncoder', value=DABEncoder)
    _register.add('DABEncoderLayer', value=DABEncoderLayer)
    _register.add('MLP', value=MLP)
    _register.add('ResnetBlock', value=ResnetBlock)
    _register.add('ResLayer', value=ResLayer)


_build_registry()  # build when module load.


def build_dl_model_modules(cfg=None, callable_name=None):
    """
    build backbone

    Args:
        callable_name: module name
        cfg: must contain num_features;

    Returns:

    """
    return REGISTER_FACTORY.build_from_config(_registry_name, cfg, callable_name)
